﻿using Common.DBHelp;
using Microsoft.EntityFrameworkCore;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
    public class HomeDAL
    {
        private readonly MySqlContext _context;

        public HomeDAL(MySqlContext context)
        {
            //https://www.cnblogs.com/yaopengfei/p/12194230.html   5.6
            context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
            //关闭状态同步
            context.ChangeTracker.AutoDetectChangesEnabled = false;
            //开启：context.ChangeTracker.DetectChanges();
            _context = context;
        }
        public Sysuser GetSysuserSingle(string name)
        {
            Sysuser sysuser = new Sysuser();
            sysuser = _context.Sysuser.FirstAsync(x => x.Name == name).Result;
            return sysuser;
        }
    }
}
